<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0,viewport-fit=cover"><title>Sololearn 自学机器学习（6）分类 Classification | 麦甜怪圈 Xiaomai Circle</title><meta name="author" content="小麦 Andrew Xiaomai"><meta name="copyright" content="小麦 Andrew Xiaomai"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="ffffff"><meta name="description" content="本篇笔记是从 Sololearn 自学而来的心得：《分类 Classification》 篇">
<meta property="og:type" content="article">
<meta property="og:title" content="Sololearn 自学机器学习（6）分类 Classification">
<meta property="og:url" content="https://kingsmai.github.io/2023/12/19/ML-6-%E5%88%86%E7%B1%BB-Classification/index.html">
<meta property="og:site_name" content="麦甜怪圈 Xiaomai Circle">
<meta property="og:description" content="本篇笔记是从 Sololearn 自学而来的心得：《分类 Classification》 篇">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://kingsmai.github.io/img/covers/classifications-3.jpeg">
<meta property="article:published_time" content="2023-12-19T05:36:19.000Z">
<meta property="article:modified_time" content="2023-12-19T12:05:10.695Z">
<meta property="article:author" content="小麦 Andrew Xiaomai">
<meta property="article:tag" content="人工智能">
<meta property="article:tag" content="机器学习">
<meta property="article:tag" content="Sololearn">
<meta property="article:tag" content="Classification">
<meta property="article:tag" content="分类">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://kingsmai.github.io/img/covers/classifications-3.jpeg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://kingsmai.github.io/2023/12/19/ML-6-%E5%88%86%E7%B1%BB-Classification/index.html"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = {
  root: '/',
  algolia: undefined,
  localSearch: {"path":"/search.xml","preload":false,"top_n_per_article":1,"unescape":false,"languages":{"hits_empty":"找不到您查询的内容：${query}","hits_stats":"共找到 ${hits} 篇文章"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: {"limitDay":365,"position":"top","messagePrev":"这篇文章已经","messageNext":"天未被更新了，可能里边的内容已经过时，请注意斟酌。"},
  highlight: {"plugin":"highlight.js","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":200},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  dateSuffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: 小麦 Andrew Xiaomai","link":"链接: ","source":"来源: 麦甜怪圈 Xiaomai Circle","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体中文","cht_to_chs":"你已切换为简体中文","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#1f1f1f","position":"bottom-left"},
  infinitegrid: {
    js: 'https://cdn.jsdelivr.net/npm/@egjs/infinitegrid/dist/infinitegrid.min.js',
    buttonText: '加载更多'
  },
  isPhotoFigcaption: true,
  islazyload: false,
  isAnchor: true,
  percent: {
    toc: true,
    rightside: true,
  },
  autoDarkmode: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'Sololearn 自学机器学习（6）分类 Classification',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2023-12-19 20:05:10'
}</script><script>(win=>{
      win.saveToLocal = {
        set: (key, value, ttl) => {
          if (ttl === 0) return
          const now = Date.now()
          const expiry = now + ttl * 86400000
          const item = {
            value,
            expiry
          }
          localStorage.setItem(key, JSON.stringify(item))
        },
      
        get: key => {
          const itemStr = localStorage.getItem(key)
      
          if (!itemStr) {
            return undefined
          }
          const item = JSON.parse(itemStr)
          const now = Date.now()
      
          if (now > item.expiry) {
            localStorage.removeItem(key)
            return undefined
          }
          return item.value
        }
      }
    
      win.getScript = (url, attr = {}) => new Promise((resolve, reject) => {
        const script = document.createElement('script')
        script.src = url
        script.async = true
        script.onerror = reject
        script.onload = script.onreadystatechange = function() {
          const loadState = this.readyState
          if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
          script.onload = script.onreadystatechange = null
          resolve()
        }

        Object.keys(attr).forEach(key => {
          script.setAttribute(key, attr[key])
        })

        document.head.appendChild(script)
      })
    
      win.getCSS = (url, id = false) => new Promise((resolve, reject) => {
        const link = document.createElement('link')
        link.rel = 'stylesheet'
        link.href = url
        if (id) link.id = id
        link.onerror = reject
        link.onload = link.onreadystatechange = function() {
          const loadState = this.readyState
          if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
          link.onload = link.onreadystatechange = null
          resolve()
        }
        document.head.appendChild(link)
      })
    
      win.activateDarkMode = () => {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = () => {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', 'ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          const now = new Date()
          const hour = now.getHours()
          const isNight = hour <= 6 || hour >= 18
          if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
          else if (t === 'light') activateLightMode()
          else activateDarkMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
      const detectApple = () => {
        if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
          document.documentElement.classList.add('apple')
        }
      }
      detectApple()
    })(window)</script><link rel="stylesheet" href="https://at.alicdn.com/t/c/font_4366094_hx3hbrje2st.css"><meta name="generator" content="Hexo 7.0.0"><link rel="alternate" href="/atom.xml" title="麦甜怪圈 Xiaomai Circle" type="application/atom+xml">
<link rel="alternate" href="/rss2.xml" title="麦甜怪圈 Xiaomai Circle" type="application/rss+xml">
</head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://avatars.githubusercontent.com/u/23566051?s=400&amp;u=cc8834557b9fe7ca3db3adc89606ae47503e603d&amp;v=4" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">54</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">37</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">28</div></a></div><hr class="custom-hr"/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 文章</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fas fa-list"></i><span> 列表</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('/img/covers/classifications-3.jpeg')"><nav id="nav"><span id="blog-info"><a href="/" title="麦甜怪圈 Xiaomai Circle"><img class="site-icon" src="/img/logos/Logo-11.jpg"/><span class="site-name">麦甜怪圈 Xiaomai Circle</span></a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 文章</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fa-fw fas fa-list"></i><span> 列表</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> 链接</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page" href="javascript:void(0);" rel="external nofollow noreferrer"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">Sololearn 自学机器学习（6）分类 Classification</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2023-12-19T05:36:19.000Z" title="发表于 2023-12-19 13:36:19">2023-12-19</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2023-12-19T12:05:10.695Z" title="更新于 2023-12-19 20:05:10">2023-12-19</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E9%A2%86%E5%9F%9F/">领域</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80/">编程语言</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E9%A2%86%E5%9F%9F/%E4%BA%BA%E5%B7%A5%E6%99%BA%E8%83%BD/">人工智能</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E7%BC%96%E7%A8%8B%E8%AF%AD%E8%A8%80/Python/">Python</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E9%A2%86%E5%9F%9F/%E4%BA%BA%E5%B7%A5%E6%99%BA%E8%83%BD/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/">机器学习</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">2.3k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>7分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="Sololearn 自学机器学习（6）分类 Classification"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="分类在机器学习中属于哪一个部分"><a href="#分类在机器学习中属于哪一个部分" class="headerlink" title="分类在机器学习中属于哪一个部分"></a>分类在机器学习中属于哪一个部分</h1><p>机器学习的顶层是由<strong>监督学习</strong>和<strong>无监督学习</strong>所组成的。<strong>分类</strong>在一个较高层次上属于监督学习的一部分。</p>
<p>监督学习是指我们将用一组有标记的历史数据来训练我们的模型。我们称那个标签（Label）或我们试图预测的事物为<strong>目标（Target）</strong>。因此，在监督学习中，历史数据有一个已知的目标，而在无监督学习中没有已知的目标。</p>
<p>在监督学习中，有<strong>分类（Classification）</strong>和<strong>回归（Regression）</strong>两种。<strong>分类问题</strong>是目标是分类值的情况（通常是True或False，但也可以是多个类别）。<strong>回归问题</strong>是目标是数值的情况。</p>
<p>例如，预测房价是一个<strong>回归问题</strong>。</p>
<ul>
<li>它是属于监督学习的一种，因为我们有过去房屋销售的历史数据。</li>
<li>它是回归问题，因为房价是一个数值。</li>
</ul>
<p>预测某人是否会违约是一个<strong>分类问题</strong>。</p>
<ul>
<li>同样，它是监督学习，因为我们有过去借款人是否违约的历史数据，</li>
<li>它是一个<strong>分类问题</strong>，因为我们试图预测贷款是否属于两个类别之一（违约或不违约）。</li>
</ul>
<p><strong>逻辑回归（Logic Regression）</strong>虽然在其名称中包含“回归”，但是是用于解决<strong>分类问题</strong>的算法，而不是<strong>回归问题</strong>。</p>
<h1 id="分类-Classification-术语-Terminology"><a href="#分类-Classification-术语-Terminology" class="headerlink" title="分类 Classification 术语 Terminology"></a>分类 Classification 术语 Terminology</h1><p>让我们回顾一下我们的泰坦尼克号数据集。这是该数据集的 Pandas DataFrame：</p>
<figure class="highlight plaintext"><table><tr><td class="code"><pre><span class="line">    Survived  Pclass     Sex   Age  Siblings/Spouses  Parents/Children     Fare</span><br><span class="line">0          0       3  female  22.0                 1                 0   7.2500</span><br><span class="line">1          1       3  female  22.0                 1                 0  71.2833</span><br><span class="line">2          1       3  female  22.0                 1                 0   7.9250</span><br><span class="line">3          1       3  female  22.0                 1                 0  53.1000</span><br><span class="line">4          1       3  female  22.0                 1                 0   8.0500</span><br></pre></td></tr></table></figure>
<p><strong>Survived</strong> 列是我们试图预测的内容。我们称之为<strong>目标（Target）</strong>。你可以看到它是一个由 1 和 0 组成的列表。1 表示乘客幸存，0 表示乘客未幸存。</p>
<p>其余的列是关于我们可以用来预测目标的乘客的信息。我们称这些列中的每一列为<strong>特征（Features）</strong>。特征是我们用来进行预测的数据。</p>
<p>虽然我们知道数据集中的每个乘客是否幸存，但我们希望能够对我们无法收集到其数据的其他乘客进行预测。我们将构建一个机器学习模型来帮助我们做到这一点。</p>
<div class="note info flat"><p>有时你会听到把特征称为预测变量 predictors。</p>
</div>
<h1 id="线性分类模型"><a href="#线性分类模型" class="headerlink" title="线性分类模型"></a><strong>线性分类模型</strong></h1><p>在机器学习中，线性模型是一种常见的分类方法。</p>
<details class="toggle" ><summary class="toggle-button" style="">让我们简要了解线性分类模型（内容涉及数学，慎重展开）</summary><div class="toggle-content"><p>线性分类模型的基本思想是通过一个线性方程对输入特征进行加权求和，然后通过一个阈值函数（也称为激活函数）将结果映射到类别标签。这个线性方程的输出表示输入特征属于某个类别的程度。</p>
<p>数学上，给定输入特征向量 $X = [X_1, X_2, …, X_n]$，线性分类模型的输出 $y$ 计算如下：</p>
<p>$y = b + w_1X_1 + w_2X_2 + … + w_nX_n$</p>
<p>其中，$b$ 是偏置项（截距），$w_1, w_2, …, w_n$ 是权重，控制每个特征在分类中的影响程度。</p>
<p>然后，通过将输出 $y$ 输入激活函数，将连续的输出映射到类别标签。一种常用的激活函数是<strong>sigmoid函数</strong>，其数学表达式为：</p>
<p>$f(y) = \frac{1}{1 + e^{-y}}$</p>
<p>在二分类问题中，如果 $f(y) &gt; 0.5$，则模型预测为正类别 $1$，否则预测为负类别 $0$。</p>
<p>这是一个简单的线性分类模型的概述。实际中，机器学习模型通常通过训练数据来学习最优的权重和偏置项，以便能够进行准确的分类。</p>
</div></details>
<h2 id="图形化的分类"><a href="#图形化的分类" class="headerlink" title="图形化的分类"></a>图形化的分类</h2><div class="note info flat"><p>在项目的最终，我们将会用到 titanic.csv 中的所有特征值，但为了简单介绍，先使用其中两个特征（Fare 和 Age）这两种特征可以帮助我们在图表中可视化数据。</p>
</div>
<p>我们将乘客票价（Fare）绘制在 X 轴上，然后将其年龄绘制在 Y 轴上。黄色点是幸存乘客，紫色电视未幸存乘客。这个图的代码如下：</p>
<figure class="highlight python"><table><tr><td class="code"><pre><span class="line">plt.scatter(df[<span class="string">&#x27;Fare&#x27;</span>], df[<span class="string">&#x27;Age&#x27;</span>], c=df[<span class="string">&#x27;Survived&#x27;</span>])</span><br></pre></td></tr></table></figure>
<p><img src="/uploads/sololearn/machine-learning/fare%20age%20survival%20scatter.jpg"/></p>
<p>你可以看到在图的底部有更多的黄色点，而在顶部有更多的紫色点。这是因为儿童比成年人更有可能幸存，这符合我们的直觉。同样，在图的右侧有更多的黄色点，意味着支付更多的人更有可能幸存。</p>
<p>线性模型的任务是找到最好地将两个类别分开的线，使得黄色点在一侧，紫色点在另一侧。</p>
<p>下面是一个好的示例。该线用于对新乘客进行预测。如果乘客的数据点位于线的右侧，我们会预测他们会幸存。如果在左侧，我们会预测他们未幸存。</p>
<div class="note danger flat"><p>这条线是根据直觉给的，不要盲目跟风。</p>
</div>
<figure class="highlight python"><table><tr><td class="code"><pre><span class="line">plt.scatter(df[<span class="string">&#x27;Fare&#x27;</span>], df[<span class="string">&#x27;Age&#x27;</span>], c=df[<span class="string">&#x27;Survived&#x27;</span>])</span><br><span class="line">plt.plot([<span class="number">25</span>, <span class="number">100</span>], [<span class="number">0</span>, <span class="number">80</span>])</span><br></pre></td></tr></table></figure>
<p><img src="/uploads/sololearn/machine-learning/fare%20age%20survival%20scatter%20w%20line.jpg"/></p>
<div class="note primary flat"><p>建立模型的挑战在于确定最佳的分隔线是什么。</p>
</div>
<h1 id="线的方程式"><a href="#线的方程式" class="headerlink" title="线的方程式"></a>线的方程式</h1><p>线的方程可以用以下形式表示：</p>
<script type="math/tex; mode=display">
0 = ax + by + c</script><p>其中，a、b 和 c 是系数。任意三个值都将定义一条唯一的直线。</p>
<p>让我们看一个具体的例子，其中系数是 a=1，b=-1，c=-30。</p>
<script type="math/tex; mode=display">
0 = (1)x + (-1)y + (-30)</script><p>三个系数分别是：1，-1，-30</p>
<p>回想一下，我们一直在用 x 轴表示乘客的票价（Fare），y 轴表示乘客的年龄（Age）。</p>
<p>为了画出方程表示的直线，我们需要两个位于直线上的点。</p>
<p>我们可以看到，例如点 (30, 0) 正好位于该直线上（票价 30，年龄 0）。如果我们将它代入方程，计算结果如下：</p>
<script type="math/tex; mode=display">
30 - 0 - 30 = 0</script><p>我们还可以看到，点 (50, 20) 位于该直线上（票价 50，年龄 20）。</p>
<script type="math/tex; mode=display">
50 - 20 - 30 = 0</script><p>以下是我们的直线在图上的样子。</p>
<p><img src="/uploads/sololearn/machine-learning/fare%20age%20survival%20scatter%20w%20line.jpg"/></p>
<div class="note info flat"><p>直线的系数控制着直线的位置。</p>
</div>
<h2 id="对线性方程式的讨论"><a href="#对线性方程式的讨论" class="headerlink" title="对线性方程式的讨论"></a>对线性方程式的讨论</h2><details class="toggle" ><summary class="toggle-button" style="">另一种表示直线的方式</summary><div class="toggle-content"><p>另一种表示直线的方式是：</p>
<script type="math/tex; mode=display">
y = mx + c</script><p>在这里，$m$ 是直线的“斜率”；</p>
<script type="math/tex; mode=display">
m = \tan \theta</script><p>$\theta$ 是直线与正 x 轴之间的角度。简而言之，$m$ 是一个数字，表示直线的倾斜程度。$\theta$ 表示水平，无穷大表示垂直，1 表示角度为 45° 或与两个轴（x 和 y）均匀倾斜。在 0 和无穷大之间的任何其他数字将直接与角度成正比（值越大，角度越大）。因此，正值 =&gt; 正角 =&gt; 逆时针旋转。负值将使直线顺时针旋转（值越负，角度越负）。</p>
<p>$c$ 是斜率，或直线与 y 轴相交的点的 y 坐标（当 $x = 0$ 时）。这种直线方程的形式可以帮助并减少确定所需直线方程所需的尝试次数。您只需要大致了解直线会倾斜多少（或与 x 轴成什么角度 $\theta$），使用计算器计算 $\tan \theta$ 并将得到的值放入 $m$ 的位置即可。</p>
</div></details>
<h1 id="基于直线的预测"><a href="#基于直线的预测" class="headerlink" title="基于直线的预测"></a>基于直线的预测</h1><blockquote>
<p>一个点位于直线的哪一侧决定了我们是否认为该乘客会幸存。</p>
</blockquote>
<p>让我们再次看看同一条直线。</p>
<script type="math/tex; mode=display">
0 = (1)x + (−1)y − 30</script><p><img src="/uploads/sololearn/machine-learning/fare%20age%20survival%20scatter%20w%20line.jpg"/></p>
<p>如果我们有一个乘客的数据，我们可以使用这个方程来确定他们在直线的哪一侧。例如，假设我们有一个票价为 100，年龄为 20 的乘客。</p>
<p>让我们将这些值代入我们的方程：</p>
<script type="math/tex; mode=display">
\begin{aligned}
(1) × 100 + (−1) × 20 − 30 \\
&= 100 − 20 − 30 \\
&= 50
\end{aligned}</script><p>由于这个值是正的，该点位于直线的右侧，我们会预测该乘客幸存。</p>
<p>现在假设一个乘客的票价是 10，年龄是 50。让我们将这些值代入方程。</p>
<script type="math/tex; mode=display">
(1) × 10 + (−1) × 50 − 30 = −70</script><p>由于这个值是负的，该点位于直线的左侧，我们会预测该乘客未幸存。</p>
<p>我们可以在下面的图中看到这两个点。</p>
<p><img src="/uploads/sololearn/machine-learning/fare%20age%20survival%20prediction.jpg"/></p>
<h1 id="什么是一条好的直线？"><a href="#什么是一条好的直线？" class="headerlink" title="什么是一条好的直线？"></a>什么是一条好的直线？</h1><p>让我们来看看两条不同的直线，首先是我们一直在使用的那条直线：我们称为直线 1</p>
<script type="math/tex; mode=display">
0 = (1)x + (−1)y − 30</script><p><img src="/uploads/sololearn/machine-learning/fare%20age%20survival%20scatter%20w%20line.jpg" alt="直线 1"/></p>
<p>接下来是我们定义的另外一条直线方程，我们称之为直线 2</p>
<script type="math/tex; mode=display">
0 = (4)x + (5)y − 400</script><p><img src="/uploads/sololearn/machine-learning/fare%20age%20survival%20scatter%20w%20line%202.jpg" alt="直线 2"/></p>
<p>如果我们看这两条直线，我们会发现直线 1 在右侧有更多的黄色点，左侧有更多的紫色点。直线 2 在右侧没有太多点；大多数紫色和黄色点都在左侧。这使直线 1 成为更好的选择，因为它更好地分离了黄色和紫色点。</p>
<p>我们需要在数学上定义这个想法，以便我们可以通过算法找到最佳的直线。</p>
<p><strong>逻辑回归</strong>是一种数学方法，可以找到最佳的直线。</p>
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta"><i class="fas fa-circle-user fa-fw"></i>文章作者: </span><span class="post-copyright-info"><a href="https://kingsmai.github.io">小麦 Andrew Xiaomai</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta"><i class="fas fa-square-arrow-up-right fa-fw"></i>文章链接: </span><span class="post-copyright-info"><a href="https://kingsmai.github.io/2023/12/19/ML-6-%E5%88%86%E7%B1%BB-Classification/">https://kingsmai.github.io/2023/12/19/ML-6-分类-Classification/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta"><i class="fas fa-circle-exclamation fa-fw"></i>版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" rel="external nofollow noreferrer" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://kingsmai.github.io" target="_blank">麦甜怪圈 Xiaomai Circle</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E4%BA%BA%E5%B7%A5%E6%99%BA%E8%83%BD/">人工智能</a><a class="post-meta__tags" href="/tags/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0/">机器学习</a><a class="post-meta__tags" href="/tags/Sololearn/">Sololearn</a><a class="post-meta__tags" href="/tags/Classification/">Classification</a><a class="post-meta__tags" href="/tags/%E5%88%86%E7%B1%BB/">分类</a></div><div class="post_share"><div class="social-share" data-image="/img/covers/classifications-3.jpeg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i>欢迎打赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="/img/wallets/WechatPaySquare.jpg" target="_blank"><img class="post-qr-code-img" src="/img/wallets/WechatPaySquare.jpg" alt="微信"/></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="/img/wallets/AlipaySquare.jpg" target="_blank"><img class="post-qr-code-img" src="/img/wallets/AlipaySquare.jpg" alt="支付宝"/></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/2023/12/19/ML-5-Matplotlib-%E7%BB%98%E5%9B%BE%E5%9F%BA%E7%A1%80/" title="Sololearn 自学机器学习（5）Matplotlib 绘图基础"><img class="cover" src="/img/covers/matplotlib-plot-basic-5.jpeg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">Sololearn 自学机器学习（5）Matplotlib 绘图基础</div></div></a></div><div class="next-post pull-right"><a href="/2023/12/19/ML-7-%E7%BA%BF%E6%80%A7%E5%9B%9E%E5%BD%92%E6%A8%A1%E5%9E%8B/" title="Sololearn 自学机器学习（7）线性回归模型"><img class="cover" src="/img/covers/linear-regression-3.jpeg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Sololearn 自学机器学习（7）线性回归模型</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/2023/12/18/ML-1-%E5%9F%BA%E7%A1%80%E7%AF%87/" title="Sololearn 自学机器学习（1）基础篇"><img class="cover" src="/img/covers/Machine-Learning-2.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-12-18</div><div class="title">Sololearn 自学机器学习（1）基础篇</div></div></a></div><div><a href="/2023/12/18/ML-2-%E7%BB%9F%E8%AE%A1%E5%AD%A6%E5%9B%9E%E9%A1%BE/" title="Sololearn 自学机器学习（2）统计学回顾"><img class="cover" src="/img/covers/statistics-review-1.jpeg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-12-18</div><div class="title">Sololearn 自学机器学习（2）统计学回顾</div></div></a></div><div><a href="/2023/12/18/ML-3-Pandas-%E6%95%B0%E6%8D%AE%E8%AF%BB%E5%8F%96%E4%B8%8E%E5%A4%84%E7%90%86/" title="Sololearn 自学机器学习（3） Pandas 数据读取与处理"><img class="cover" src="/img/covers/python-pandas-1.jpeg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-12-18</div><div class="title">Sololearn 自学机器学习（3） Pandas 数据读取与处理</div></div></a></div><div><a href="/2023/12/18/ML-4-Numpy-%E6%95%B0%E6%8D%AE%E5%A4%84%E7%90%86/" title="Sololearn 自学机器学习（4）Numpy 数据处理"><img class="cover" src="/img/covers/numpy-data-processing-2.jpeg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-12-18</div><div class="title">Sololearn 自学机器学习（4）Numpy 数据处理</div></div></a></div><div><a href="/2023/12/19/ML-5-Matplotlib-%E7%BB%98%E5%9B%BE%E5%9F%BA%E7%A1%80/" title="Sololearn 自学机器学习（5）Matplotlib 绘图基础"><img class="cover" src="/img/covers/matplotlib-plot-basic-5.jpeg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-12-19</div><div class="title">Sololearn 自学机器学习（5）Matplotlib 绘图基础</div></div></a></div><div><a href="/2023/12/19/ML-7-%E7%BA%BF%E6%80%A7%E5%9B%9E%E5%BD%92%E6%A8%A1%E5%9E%8B/" title="Sololearn 自学机器学习（7）线性回归模型"><img class="cover" src="/img/covers/linear-regression-3.jpeg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2023-12-19</div><div class="title">Sololearn 自学机器学习（7）线性回归模型</div></div></a></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://avatars.githubusercontent.com/u/23566051?s=400&amp;u=cc8834557b9fe7ca3db3adc89606ae47503e603d&amp;v=4" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">小麦 Andrew Xiaomai</div><div class="author-info__description">一个喜欢肉鸽类游戏的程序员<br>分享日常生活，学习笔记，技术文章等。感兴趣想一起开发游戏的欢迎联系我哟！</div></div><div class="card-info-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">54</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">37</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">28</div></a></div><a id="card-info-btn" target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/kingsmai"><i class="fab fa-github"></i><span>关注我</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/kingsmai" rel="external nofollow noreferrer" target="_blank" title="Github"><i class="iconfont icon-GitHub" style="color: #24292e;"></i></a><a class="social-icon" href="https://space.bilibili.com/670118055" rel="external nofollow noreferrer" target="_blank" title="BiliBili"><i class="iconfont icon-bilibili-fill" style="color: #ff6699;"></i></a><a class="social-icon" href="mailto:xsbugh@gmail.com" rel="external nofollow noreferrer" target="_blank" title="Email"><i class="iconfont icon-email-fill" style="color: #ff3e30;"></i></a><a class="social-icon" href="https://www.zhihu.com/people/creeper0924" rel="external nofollow noreferrer" target="_blank" title="Zhihu"><i class="iconfont icon-zhihu" style="color: #1772F6;"></i></a><a class="social-icon" href="https://blog.csdn.net/Xsbugh" rel="external nofollow noreferrer" target="_blank" title="CSDN"><i class="iconfont icon-csdn" style="color: #FC4144;"></i></a><a class="social-icon" href="https://www.linkedin.com/in/%E5%B0%8F%E9%BA%A6-xiaomai-0a672124b/" rel="external nofollow noreferrer" target="_blank" title="LinkedIn"><i class="iconfont icon-linkedin" style="color: #0A66C2;"></i></a><a class="social-icon" href="/atom.xml" target="_blank" title="RSS 链接"><i class="iconfont icon-Atom" style="color: #6EA3E5;"></i></a><a class="social-icon" href="/rss2.xml" target="_blank" title="RSS 链接"><i class="iconfont icon-dingyue" style="color: #ee802f;"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn fa-shake"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div><div class="card-widget"><div class="item-headline"><i></i><span></span></div><div class="item-content"></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%88%86%E7%B1%BB%E5%9C%A8%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E4%B8%AD%E5%B1%9E%E4%BA%8E%E5%93%AA%E4%B8%80%E4%B8%AA%E9%83%A8%E5%88%86"><span class="toc-number">1.</span> <span class="toc-text">分类在机器学习中属于哪一个部分</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%88%86%E7%B1%BB-Classification-%E6%9C%AF%E8%AF%AD-Terminology"><span class="toc-number">2.</span> <span class="toc-text">分类 Classification 术语 Terminology</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%BA%BF%E6%80%A7%E5%88%86%E7%B1%BB%E6%A8%A1%E5%9E%8B"><span class="toc-number">3.</span> <span class="toc-text">线性分类模型</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9B%BE%E5%BD%A2%E5%8C%96%E7%9A%84%E5%88%86%E7%B1%BB"><span class="toc-number">3.1.</span> <span class="toc-text">图形化的分类</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%BA%BF%E7%9A%84%E6%96%B9%E7%A8%8B%E5%BC%8F"><span class="toc-number">4.</span> <span class="toc-text">线的方程式</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%AF%B9%E7%BA%BF%E6%80%A7%E6%96%B9%E7%A8%8B%E5%BC%8F%E7%9A%84%E8%AE%A8%E8%AE%BA"><span class="toc-number">4.1.</span> <span class="toc-text">对线性方程式的讨论</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%9F%BA%E4%BA%8E%E7%9B%B4%E7%BA%BF%E7%9A%84%E9%A2%84%E6%B5%8B"><span class="toc-number">5.</span> <span class="toc-text">基于直线的预测</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E4%BB%80%E4%B9%88%E6%98%AF%E4%B8%80%E6%9D%A1%E5%A5%BD%E7%9A%84%E7%9B%B4%E7%BA%BF%EF%BC%9F"><span class="toc-number">6.</span> <span class="toc-text">什么是一条好的直线？</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2023/12/20/ML-8-%E6%9E%84%E5%BB%BA%E9%80%BB%E8%BE%91%E5%9B%9E%E5%BD%92%E6%A8%A1%E5%9E%8B/" title="Sololearn 自学机器学习（8）构建逻辑回归模型"><img src="/img/covers/sklearn-build-linear-regression-model.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Sololearn 自学机器学习（8）构建逻辑回归模型"/></a><div class="content"><a class="title" href="/2023/12/20/ML-8-%E6%9E%84%E5%BB%BA%E9%80%BB%E8%BE%91%E5%9B%9E%E5%BD%92%E6%A8%A1%E5%9E%8B/" title="Sololearn 自学机器学习（8）构建逻辑回归模型">Sololearn 自学机器学习（8）构建逻辑回归模型</a><time datetime="2023-12-19T16:15:57.000Z" title="发表于 2023-12-20 00:15:57">2023-12-20</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/12/19/ML-7-%E7%BA%BF%E6%80%A7%E5%9B%9E%E5%BD%92%E6%A8%A1%E5%9E%8B/" title="Sololearn 自学机器学习（7）线性回归模型"><img src="/img/covers/linear-regression-3.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Sololearn 自学机器学习（7）线性回归模型"/></a><div class="content"><a class="title" href="/2023/12/19/ML-7-%E7%BA%BF%E6%80%A7%E5%9B%9E%E5%BD%92%E6%A8%A1%E5%9E%8B/" title="Sololearn 自学机器学习（7）线性回归模型">Sololearn 自学机器学习（7）线性回归模型</a><time datetime="2023-12-19T08:07:36.000Z" title="发表于 2023-12-19 16:07:36">2023-12-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/12/19/ML-6-%E5%88%86%E7%B1%BB-Classification/" title="Sololearn 自学机器学习（6）分类 Classification"><img src="/img/covers/classifications-3.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Sololearn 自学机器学习（6）分类 Classification"/></a><div class="content"><a class="title" href="/2023/12/19/ML-6-%E5%88%86%E7%B1%BB-Classification/" title="Sololearn 自学机器学习（6）分类 Classification">Sololearn 自学机器学习（6）分类 Classification</a><time datetime="2023-12-19T05:36:19.000Z" title="发表于 2023-12-19 13:36:19">2023-12-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/12/19/ML-5-Matplotlib-%E7%BB%98%E5%9B%BE%E5%9F%BA%E7%A1%80/" title="Sololearn 自学机器学习（5）Matplotlib 绘图基础"><img src="/img/covers/matplotlib-plot-basic-5.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Sololearn 自学机器学习（5）Matplotlib 绘图基础"/></a><div class="content"><a class="title" href="/2023/12/19/ML-5-Matplotlib-%E7%BB%98%E5%9B%BE%E5%9F%BA%E7%A1%80/" title="Sololearn 自学机器学习（5）Matplotlib 绘图基础">Sololearn 自学机器学习（5）Matplotlib 绘图基础</a><time datetime="2023-12-18T17:08:34.000Z" title="发表于 2023-12-19 01:08:34">2023-12-19</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2023/12/18/ML-4-Numpy-%E6%95%B0%E6%8D%AE%E5%A4%84%E7%90%86/" title="Sololearn 自学机器学习（4）Numpy 数据处理"><img src="/img/covers/numpy-data-processing-2.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Sololearn 自学机器学习（4）Numpy 数据处理"/></a><div class="content"><a class="title" href="/2023/12/18/ML-4-Numpy-%E6%95%B0%E6%8D%AE%E5%A4%84%E7%90%86/" title="Sololearn 自学机器学习（4）Numpy 数据处理">Sololearn 自学机器学习（4）Numpy 数据处理</a><time datetime="2023-12-18T13:26:11.000Z" title="发表于 2023-12-18 21:26:11">2023-12-18</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('/img/covers/classifications-3.jpeg')"><div id="footer-wrap"><div class="copyright">&copy;2019 - 2023 By 小麦 Andrew Xiaomai</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener external nofollow noreferrer" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text"><a href="https://icp.gov.moe/?keyword=20235160" rel="external nofollow noreferrer" target="_blank"><img class="icp-icon" src="/img/moe-icons/icon120.png">备案号：✮萌ICP备20235160号✮</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><div class="js-pjax"><script>if (!window.MathJax) {
  window.MathJax = {
    tex: {
      inlineMath: [['$', '$'], ['\\(', '\\)']],
      tags: 'ams'
    },
    chtml: {
      scale: 1.1
    },
    options: {
      renderActions: {
        findScript: [10, doc => {
          for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
            const display = !!node.type.match(/; *mode=display/)
            const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display)
            const text = document.createTextNode('')
            node.parentNode.replaceChild(text, node)
            math.start = {node: text, delim: '', n: 0}
            math.end = {node: text, delim: '', n: 0}
            doc.math.push(math)
          }
        }, '']
      }
    }
  }
  
  const script = document.createElement('script')
  script.src = 'https://cdn.jsdelivr.net/npm/mathjax/es5/tex-mml-chtml.min.js'
  script.id = 'MathJax-script'
  script.async = true
  document.head.appendChild(script)
} else {
  MathJax.startup.document.state(0)
  MathJax.texReset()
  MathJax.typesetPromise()
}</script></div><canvas class="fireworks" mobile="true"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/fireworks.min.js"></script><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/canvas-fluttering-ribbon.min.js"></script><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc/dist/activate-power-mode.min.js"></script><script>POWERMODE.colorful = true;
POWERMODE.shake = true;
POWERMODE.mobile = false;
document.body.addEventListener('input', POWERMODE);
</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div><div id="local-search-stats-wrap"></div></div></div><div id="search-mask"></div><script src="/js/search/local-search.js"></script></div></div></body></html>